# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'WikiUser'
        db.create_table(u'Wiki_wikiuser', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.related.OneToOneField')(related_name='WikiUser', unique=True, to=orm['auth.User'])),
        ))
        db.send_create_signal(u'Wiki', ['WikiUser'])

        # Adding model 'WikiGroup'
        db.create_table(u'Wiki_wikigroup', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
        ))
        db.send_create_signal(u'Wiki', ['WikiGroup'])

        # Adding M2M table for field member on 'WikiGroup'
        m2m_table_name = db.shorten_name(u'Wiki_wikigroup_member')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('wikigroup', models.ForeignKey(orm[u'Wiki.wikigroup'], null=False)),
            ('wikiuser', models.ForeignKey(orm[u'Wiki.wikiuser'], null=False))
        ))
        db.create_unique(m2m_table_name, ['wikigroup_id', 'wikiuser_id'])

        # Adding model 'Page'
        db.create_table(u'Wiki_page', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('is_redirect', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'Wiki', ['Page'])

        # Adding model 'Redirect'
        db.create_table(u'Wiki_redirect', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('page_form', self.gf('django.db.models.fields.related.OneToOneField')(related_name='redirect', unique=True, to=orm['Wiki.Page'])),
            ('page_to', self.gf('django.db.models.fields.related.OneToOneField')(related_name='come_form', unique=True, to=orm['Wiki.Page'])),
            ('activation', self.gf('django.db.models.fields.BooleanField')(default=True)),
        ))
        db.send_create_signal(u'Wiki', ['Redirect'])

        # Adding model 'Category'
        db.create_table(u'Wiki_category', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='get_sub_category', null=True, to=orm['Wiki.Category'])),
            ('root', self.gf('django.db.models.fields.BooleanField')(default=True)),
        ))
        db.send_create_signal(u'Wiki', ['Category'])

        # Adding model 'Archive'
        db.create_table(u'Wiki_archive', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('page', self.gf('django.db.models.fields.related.ForeignKey')(related_name='get_archive', to=orm['Wiki.Page'])),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('content', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
            ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('editor', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['Wiki.WikiUser'])),
            ('editor_fullname', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
            ('ip', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('category', self.gf('django.db.models.fields.related.ForeignKey')(related_name='get_archive', to=orm['Wiki.Category'])),
        ))
        db.send_create_signal(u'Wiki', ['Archive'])

        # Adding model 'RecentChange'
        db.create_table(u'Wiki_recentchange', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('page', self.gf('django.db.models.fields.related.ForeignKey')(related_name='get_recent_change', to=orm['Wiki.Page'])),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
            ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('editor', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['Wiki.WikiUser'])),
            ('editor_fullname', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
            ('this_old', self.gf('django.db.models.fields.related.ForeignKey')(related_name='before_change', to=orm['Wiki.Archive'])),
            ('this_last', self.gf('django.db.models.fields.related.ForeignKey')(related_name='after_change', to=orm['Wiki.Archive'])),
            ('ip', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
        ))
        db.send_create_signal(u'Wiki', ['RecentChange'])

        # Adding model 'Tag'
        db.create_table(u'Wiki_tag', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
        ))
        db.send_create_signal(u'Wiki', ['Tag'])

        # Adding M2M table for field archives on 'Tag'
        m2m_table_name = db.shorten_name(u'Wiki_tag_archives')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('tag', models.ForeignKey(orm[u'Wiki.tag'], null=False)),
            ('archive', models.ForeignKey(orm[u'Wiki.archive'], null=False))
        ))
        db.create_unique(m2m_table_name, ['tag_id', 'archive_id'])

        # Adding model 'Picture'
        db.create_table(u'Wiki_picture', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
            ('file', self.gf('django.db.models.fields.files.ImageField')(max_length=100)),
        ))
        db.send_create_signal(u'Wiki', ['Picture'])


    def backwards(self, orm):
        # Deleting model 'WikiUser'
        db.delete_table(u'Wiki_wikiuser')

        # Deleting model 'WikiGroup'
        db.delete_table(u'Wiki_wikigroup')

        # Removing M2M table for field member on 'WikiGroup'
        db.delete_table(db.shorten_name(u'Wiki_wikigroup_member'))

        # Deleting model 'Page'
        db.delete_table(u'Wiki_page')

        # Deleting model 'Redirect'
        db.delete_table(u'Wiki_redirect')

        # Deleting model 'Category'
        db.delete_table(u'Wiki_category')

        # Deleting model 'Archive'
        db.delete_table(u'Wiki_archive')

        # Deleting model 'RecentChange'
        db.delete_table(u'Wiki_recentchange')

        # Deleting model 'Tag'
        db.delete_table(u'Wiki_tag')

        # Removing M2M table for field archives on 'Tag'
        db.delete_table(db.shorten_name(u'Wiki_tag_archives'))

        # Deleting model 'Picture'
        db.delete_table(u'Wiki_picture')


    models = {
        u'Wiki.archive': {
            'Meta': {'object_name': 'Archive'},
            'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'get_archive'", 'to': u"orm['Wiki.Category']"}),
            'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'editor': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['Wiki.WikiUser']"}),
            'editor_fullname': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'get_archive'", 'to': u"orm['Wiki.Page']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
        },
        u'Wiki.category': {
            'Meta': {'object_name': 'Category'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'get_sub_category'", 'null': 'True', 'to': u"orm['Wiki.Category']"}),
            'root': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        u'Wiki.page': {
            'Meta': {'object_name': 'Page'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_redirect': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        u'Wiki.picture': {
            'Meta': {'object_name': 'Picture'},
            'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'})
        },
        u'Wiki.recentchange': {
            'Meta': {'object_name': 'RecentChange'},
            'editor': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['Wiki.WikiUser']"}),
            'editor_fullname': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'get_recent_change'", 'to': u"orm['Wiki.Page']"}),
            'this_last': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'after_change'", 'to': u"orm['Wiki.Archive']"}),
            'this_old': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'before_change'", 'to': u"orm['Wiki.Archive']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
        },
        u'Wiki.redirect': {
            'Meta': {'object_name': 'Redirect'},
            'activation': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'page_form': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'redirect'", 'unique': 'True', 'to': u"orm['Wiki.Page']"}),
            'page_to': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'come_form'", 'unique': 'True', 'to': u"orm['Wiki.Page']"}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        u'Wiki.tag': {
            'Meta': {'object_name': 'Tag'},
            'archives': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'get_tag'", 'null': 'True', 'to': u"orm['Wiki.Archive']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'})
        },
        u'Wiki.wikigroup': {
            'Meta': {'object_name': 'WikiGroup'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'member': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['Wiki.WikiUser']", 'null': 'True', 'symmetrical': 'False'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
        },
        u'Wiki.wikiuser': {
            'Meta': {'object_name': 'WikiUser'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'WikiUser'", 'unique': 'True', 'to': u"orm['auth.User']"})
        },
        u'auth.group': {
            'Meta': {'object_name': 'Group'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        u'auth.permission': {
            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        u'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        }
    }

    complete_apps = ['Wiki']